package cn.javadog.ssp.spring.ioc.simple;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author 余勇
 * @date 2019年11月27日 14:10:00
 */
public class BeanPostProcessorBean implements BeanPostProcessor {

	public BeanPostProcessorBean() {
		{
			System.out.println("实例化BeanPostProcessorBean");
		}
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("调用BeanPostProcessor的before方法");
		// todo 在这里可以更改bean吗？这里返回值有什么用？
		// note 不要瞎鸡儿动
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("调用BeanPostProcessor的after方法");
		return bean;
	}

}
